#ifndef SEQ_INCLUDED
#define SEQ_INCLUDED
// seq is like a circle queue, but can only add or remove in the hi/low position

#define T Seq_T
typedef struct T *T;

extern T Seq_new(int hint);
// example:  Seq_t names = Seq_seq("c", "msl", "Icon", NULL);
extern T Seq_seq(void *x, ...);
extern void Seq_free(T *seq);
extern int Seq_length(T seq);
extern void *Seq_get(T seq, int i);
extern void *Seq_put(T seq, int i, void *x);

/**
 * @brief add x to low(head of sequence), and returen x
 *
 * @param seq
 * @param x
 * @return void*
 */
extern void *Seq_addlo(T seq, void *x);

/**
 * @brief add x to high(end of sequence), and returen x
 *
 * @param seq
 * @param x
 * @return void*
 */
extern void *Seq_addhi(T seq, void *x);
extern void *Seq_remlo(T seq);
extern void *Seq_remhi(T seq);
#undef T
#endif